package com.gasolinator.a.app.activity.map;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.location.Location;
import com.gasolinator.a.R;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;
import com.google.android.maps.Projection;

public class FixedMyLocationOverlay extends MyLocationOverlay
{
  private Paint accuracyPaint;
  private boolean bugged = false;
  private Point center;
  private Drawable drawable;
  private int height;
  private Point left;
  private int width;

  public FixedMyLocationOverlay(Context paramContext, MapView paramMapView)
  {
    super(paramContext, paramMapView);
  }

  protected void drawMyLocation(Canvas paramCanvas, MapView paramMapView, Location paramLocation, GeoPoint paramGeoPoint, long paramLong)
  {
    if (!this.bugged);
    try
    {
      super.drawMyLocation(paramCanvas, paramMapView, paramLocation, paramGeoPoint, paramLong);
      if (!this.bugged)
        return;
      if (this.drawable == null)
      {
        Paint localPaint1 = new Paint();
        this.accuracyPaint = localPaint1;
        this.accuracyPaint.setAntiAlias(true);
        this.accuracyPaint.setStrokeWidth(2.0F);
        Drawable localDrawable1 = paramMapView.getContext().getResources().getDrawable(R.drawable.mylocation);
        this.drawable = localDrawable1;
        int i = this.drawable.getIntrinsicWidth();
        this.width = i;
        int j = this.drawable.getIntrinsicHeight();
        this.height = j;
        Point localPoint1 = new Point();
        this.center = localPoint1;
        Point localPoint2 = new Point();
        this.left = localPoint2;
      }
      Projection localProjection1 = paramMapView.getProjection();
      double d1 = paramLocation.getLatitude();
      double d2 = paramLocation.getLongitude();
      float f1 = paramLocation.getAccuracy();
      float[] arrayOfFloat = new float[1];
      double d3 = d2 + 1.0D;
      double d4 = d1;
      Location.distanceBetween(d1, d2, d4, d3, arrayOfFloat);
      float k = arrayOfFloat[0];
      int m = (int)(1000000.0D * d1);
        double d5 = f1 / k;
        int n = (int)((d2 - d5) * 1000000.0D);
        //GeoPoint localGeoPoint2 = localGeoPoint1;
        int i1 = m;
        int i2 = n;
        GeoPoint localGeoPoint1 = new GeoPoint(i1, i2);
        GeoPoint localGeoPoint2= new GeoPoint(i1, i2);
      Point localPoint3 = this.left;
      Projection localProjection2 = localProjection1;
      GeoPoint localGeoPoint3 = localGeoPoint1;
      Point localPoint4 = localPoint3;
      Point localPoint5 = localProjection2.toPixels(localGeoPoint3, localPoint4);
      Point localPoint6 = this.center;
      Projection localProjection3 = localProjection1;
      GeoPoint localGeoPoint4 = paramGeoPoint;
      Point localPoint7 = localPoint6;
      Point localPoint8 = localProjection3.toPixels(localGeoPoint4, localPoint7);
      int i3 = this.center.x;
      int i4 = this.left.x;
      int i5 = i3 - i4;
      this.accuracyPaint.setColor(-10066177);
      Paint localPaint2 = this.accuracyPaint;
      Style localStyle1 = Style.STROKE;
      localPaint2.setStyle(localStyle1);
      float f2 = this.center.x;
      float f3 = this.center.y;
      float f4 = i5;
      Paint localPaint3 = this.accuracyPaint;
      Canvas localCanvas1 = paramCanvas;
      float f5 = f2;
      float f6 = f3;
      float f7 = f4;
      Paint localPaint4 = localPaint3;
      localCanvas1.drawCircle(f5, f6, f7, localPaint4);
      this.accuracyPaint.setColor(409364223);
      Paint localPaint5 = this.accuracyPaint;
      Style localStyle2 = Style.FILL;
      localPaint5.setStyle(localStyle2);
      float f8 = this.center.x;
      float f9 = this.center.y;
      float f10 = i5;
      Paint localPaint6 = this.accuracyPaint;
      Canvas localCanvas2 = paramCanvas;
      float f11 = f8;
      float f12 = f9;
      float f13 = f10;
      Paint localPaint7 = localPaint6;
      localCanvas2.drawCircle(f11, f12, f13, localPaint7);
      Drawable localDrawable2 = this.drawable;
      int i6 = this.center.x;
      int i7 = this.width / 2;
      int i8 = i6 - i7;
      int i9 = this.center.y;
      int i10 = this.height / 2;
      int i11 = i9 - i10;
      int i12 = this.center.x;
      int i13 = this.width / 2;
      int i14 = i12 + i13;
      int i15 = this.center.y;
      int i16 = this.height / 2;
      int i17 = i15 + i16;
      localDrawable2.setBounds(i8, i11, i14, i17);
      Drawable localDrawable3 = this.drawable;
      Canvas localCanvas3 = paramCanvas;
      localDrawable3.draw(localCanvas3);
      return;
    }
    catch (Exception localException)
    {
      //TODO: gestionar la exception
    }
  }
}